// 引入 createStore , 当前这玩意已经不推荐使用，而是推荐我们使用 RTK
import { createStore, combineReducers, applyMiddleware } from "redux";
import { composeWithDevTools } from "@redux-devtools/extension";

// 引入 redux-thunk 中间件
// import thunk from "redux-thunk";
import thunk from "./middlewares/thunk";

// 引入自定义中间件

// 引入拆分出去的 reducer
import appReducer from "./reducers/app";
import citysReducer from "./reducers/citys";

// 组合 rootReducer
const rootReducer = combineReducers({
  app: appReducer,
  citys: citysReducer,
});

// 创建 store
const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
);

// 导出 store
export default store;
